#include "Resourceable.h"


Resourceable::Resourceable()
{
}

Resourceable::~Resourceable()
{
}

void Resourceable::SetResource(const std::string& resourceId, const std::string& resourceType)
{
	resources[resourceId].clear();

	resources[resourceId].push_back(resourceType);
}

void Resourceable::AddResourceSpecification(const std::string& resourceId, const std::string& resourceSpec)
{
	resources[resourceId].push_back(resourceSpec);
}

const std::string Resourceable::Resource(const std::string& resourceId) const
{
	std::string resource;
	std::map<std::string, std::list<std::string>>::const_iterator listIt = resources.find(resourceId);

	if (listIt != resources.end())
	{
		const std::list<std::string>& resourceList = (*listIt).second;
		std::list<std::string>::const_iterator it;

		

		for(it = resourceList.begin(); it != resourceList.end(); ++it)
		{
			if (resource.length())
				resource += "_";

			resource += (*it);
		}
	}

	return resource;
}
